/*
-----------------------------------------------------------------------------
This source file is part of Labor3D
(Labor 3D Graphics Engine)

Copyright (c) 2009-2020 Rock Mao
* creator : Rock Mao
* created : 2009-5-2   22:29
* filename: LaborIndexBuffer.cpp
-----------------------------------------------------------------------------
*/
#include "stdafx.h"
#include "LaborIndexBuffer.h"
NAMESPACE_LABOR3D_BEGIN

//---------------------------------------------------------------------
CLIndexBuffer::CLIndexBuffer(eLIndexType idxType, size_t numIndexes, EHB_Usage usage,  bool useSystemMemory, bool useShadowBuffer)
:  CLHardwareBuffer(usage, useSystemMemory, useShadowBuffer), mIndexType(idxType), mNumIndexes(numIndexes)
{
	// Calculate the size of the indexes
	switch (mIndexType)
	{
	case IT_16BIT:
		mIndexSize = sizeof(unsigned short);
		break;
	case IT_32BIT:
		mIndexSize = sizeof(unsigned int);
		break;
	}
	mSizeInBytes = mIndexSize * mNumIndexes;

	//// Create a shadow buffer if required
	//if (mUseShadowBuffer)
	//{
	//	mpShadowBuffer = OGRE_NEW DefaultHardwareIndexBuffer(mIndexType, 
	//		mNumIndexes, HardwareBuffer::HBU_DYNAMIC);
	//}
}
//---------------------------------------------------------------------
CLIndexBuffer::~CLIndexBuffer()
{

}

NAMESPACE_LABOR3D_END